import getCookie from "/utils/getCookie.js";
export default function ({ store, route, redirect, params, query, req, res }) {
  if (process.server) {
    let cookies = getCookie.getcookiesInServer(req);
    let token = cookies.gameMall_token ? cookies.gameMall_token : "";
    // console.log("在服务端" + token);
    goPage(token);
  }
  if (process.client) {
    let token = getCookie.getcookiesInClient("gameMall_token");
    // console.log("在客户端" + token);
    goPage(token);
  }
  function goPage(token) {
    if (!token) {
      return redirect("/login");
    }
  }
}
